<template>
  <div class="system-dic-dialog-container">
    <el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" width="1200px">
      <div class="map-dom">
        <MyMap></MyMap>
      </div>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" @click="onSubmit">{{ state.dialog.submitTxt }}</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup lang="ts" name="systemDicDialog">
import { reactive, ref } from 'vue';
import { MyMap } from '@/map/index';

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh']);

// 定义变量内容
const dicDialogFormRef = ref();
const state = reactive({
  details: {},
  dialog: {
    isShowDialog: false,
    title: '详情',
    submitTxt: '确定',
  },
});

// 打开弹窗
const openDialog = (row: RowDicType) => {
  state.details = row;
  state.dialog.isShowDialog = true;
};
// 关闭弹窗
const closeDialog = () => {
  state.dialog.isShowDialog = false;
};
// 取消
const onCancel = () => {
  closeDialog();
};
// 提交
const onSubmit = () => {
  closeDialog();
  emit('refresh');
  // if (state.dialog.type === 'add') { }
};

// 暴露变量
defineExpose({
  openDialog,
});
</script>

<style>
.map-dom {
  height: 70vh;
}
</style>
